//
//  ReadView.m
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/4/24.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import "ReadView.h"

@implementation ReadView

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSLog(@"%s",__func__);
}
// NSSet : 无序
// NSArray : 有序
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
     NSLog(@"%s",__func__);
     //  实现uiview的拖拽
    UITouch *touch = [touches anyObject];
    // 求偏移量 = 手指当前点的x - 手指上一个点的x
    CGPoint curP = [touch locationInView:self] ;
    CGPoint preP = [touch previousLocationInView:self];
    CGFloat offsetX = curP.x - preP.x;
    CGFloat offsetY = curP.y - preP.y;
    
    self.transform = CGAffineTransformTranslate(self.transform, offsetX, offsetY);
}

-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
     NSLog(@"%s",__func__);
}

-(void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
     NSLog(@"%s",__func__);
}

@end
